import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Service {
    public static void main(String[] args) throws IOException {
//        创建服务
        ServerSocket serverSocket = new ServerSocket(1123);
//        监听客户端连接
        Socket accept = serverSocket.accept();
//        获得输入流
        InputStream inputStream = accept.getInputStream();
        byte[]bytes = new byte[1024];
        int len = inputStream.read(bytes);
        System.out.println(new String(bytes,0,len));
        OutputStream outputStream = accept.getOutputStream();
        outputStream.write("over".getBytes());
        serverSocket.close();
        accept.close();
    }
}
